package com.ln.yygh.hosp.controller;

import com.ln.yygh.common.result.Result;


import com.ln.yygh.hosp.service.Hospitalervice;
import com.ln.yygh.model.hosp.Hospital;
import com.ln.yygh.vo.hosp.HospitalQueryVo;
import io.swagger.annotations.*;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author: lianXiaoChen
 * @create: 2021-06-01 11:30
 */
@RestController
@RequestMapping("/admin/hosp/hospital")
@Api("医院详情+列表+上线")
public class HospitalControllerByKey {
    @Autowired
    private Hospitalervice hospitalervice;

    //医院列表（条件+分页）
    @ApiOperation("医院列表（条件+分页）")
    @GetMapping("/list/{page}/{limit}")
    public Result listHosp(@PathVariable Integer page,
                           @PathVariable Integer limit,
                           HospitalQueryVo hospitalQueryVo) {
        Page pageModel = hospitalervice.selectHospPage(page, limit, hospitalQueryVo);
        return Result.ok(pageModel);

    }
    //更新医院上线状态
    @ApiOperation("更新医院上线状态")
    @GetMapping("/updateStatus/{id}/{status}")
    public Result lock(
            @PathVariable("id") String id,
            @PathVariable("status") Integer status){
        hospitalervice.updateStatus(id, status);
        return Result.ok();
    }
    //查看详情
    @ApiOperation("查看详情")
    @GetMapping("/selectHospById/{id}")
    public Result selectHospById(@PathVariable String id){
        Map<String,Object> map =  hospitalervice.selectHospById(id);
        return Result.ok(map);
    }

}
